home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr26 / 4utils73.zip / TEST286.PAS < prev    next >
Pascal/Delphi Source File  |  1993-05-01  |  1KB  |  45 lines

  1. UNIT Test286;
  2. {$D-}
  3.  
  4. { Copyright (c) 1990 by Borland International, Inc. }
  5.  
  6. (* Programs compiled with {$G} compiler directive enabled do not
  7.    check the processor at runtime to determine whether it is
  8.    286-compatible. Trying to execute 80286 instructions on an 8086
  9.    or an 8088 will lock up the computer. This program shows how to
  10.    check for the presence of a 286-compatible chip at runtime.
  11.  
  12.    If you want to put code like this in a program with {$G+}
  13.    enabled, put the test and halt code in the initialization
  14.    section of the first unit in the main program's USES clause. *)
  15.  
  16. INTERFACE
  17.  
  18. IMPLEMENTATION
  19.  
  20. FUNCTION Is286Able: BOOLEAN; ASSEMBLER;
  21.  
  22. ASM
  23.  PUSHF
  24.  POP     BX
  25.  AND     BX,0FFFH
  26.  PUSH    BX
  27.  POPF
  28.  PUSHF
  29.  POP     BX
  30.  AND     BX,0F000H
  31.  CMP     BX,0F000H
  32.  MOV     AX,0
  33.  JZ      @@1
  34.  MOV     AX,1
  35. @@1:
  36. END;
  37.  
  38. BEGIN
  39.  IF NOT Is286Able THEN
  40.   BEGIN
  41.    WriteLn('You need an 80286 or better system to run this program.');
  42.    HALT(1);
  43.   END;
  44. END.
  45.